package com.tian.system.controller;

import java.util.List;

import com.tian.common.core.controller.BaseController;
import com.tian.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tian.system.domain.Notedir;
import com.tian.system.service.INotedirService;

/**
 * 笔记目录 信息操作处理
 *
 * @author zcx
 * @date 2020-01-04 17:09:13
 */
@Controller
@RequestMapping("/system/notedir")
public class NotedirController extends BaseController {
    private String prefix = "system/notedir";

    @Autowired
    private INotedirService notedirService;

    /**
     * 查询笔记目录列表
     */
    @PostMapping("/page")
    @ResponseBody
    public TableDataInfo page(Notedir notedir) {
        startPage();
        List<Notedir> list = notedirService.selectNotedirList(notedir);
        return getDataTable(list);
    }

    /**
     * 查询笔记目录集合
     */
    @PostMapping("/list")
    @ResponseBody
    public String list(Notedir notedir) {
        List<Notedir> list = notedirService.selectNotedirList(notedir);
        return toAjax(list);
    }

    /**
     * 新增保存笔记目录
     */
    @PostMapping("/add")
    @ResponseBody
    public String addSave(Notedir notedir) {
        return toAjax(notedirService.insertNotedir(notedir));
    }

    /**
     * 修改保存笔记目录
     */
    @PostMapping("/edit")
    @ResponseBody
    public String editSave(Notedir notedir) {
        return toAjax(notedirService.updateNotedir(notedir));
    }

    /**
     * 删除笔记目录
     */
    @PostMapping("/remove")
    @ResponseBody
    public String remove(long id) {
        return toAjax(notedirService.deleteNotedirById(id));
    }

    /**
     * 删除笔记目录
     */
    @PostMapping("/removes")
    @ResponseBody
    public String removes(String ids) {
        return toAjax(notedirService.deleteNotedirByIds(ids));
    }

}
